# """
# readline()的demo
# """
# with open("a.txt", encoding="gbk") as f:
#     line = f.readline()
#     while line != "":
#         print(line, end="")
#         line = f.readline()
import json

with open("data_source/info.json", encoding="utf-8") as f:
    data = json.load(f)
    for i in data:
        if i.get('isMan'):
            gender = "男"
        else:
            gender = "女"
        # py中的条件判断运算符格式： 条件满足执行的表达式 if 条件 条件不满足执行的表达式 =>返回表达式的值
        print(f"姓名：{i.get('name')}, 年龄：{i.get('age')}"
              f"性别：{gender}, 城市：{i.get('address').get('city')}")
